import request from '@/utils/request';

// agent状态显示管理

// 根据状态查询统计数据列表
export function getAgentTable(data: any): ApiPromise<ApiResponse> {
	return request({
		url: '/management/modules/monitor/agent/getAgentTable',
		method: 'post',
		data: data,
	});
}

//查询统计正常、异常、断采个数
export function getAgentCount(): ApiPromise<ApiResponse> {
	return request({
		url: '/management/modules/monitor/agent/getAgentCount',
		method: 'get',
	});
}

//top断采信息
export function getBreakTop(): ApiPromise<ApiResponse> {
	return request({
		url: '/management/modules/monitor/agent/getBreakTop',
		method: 'get',
	});
}

//top异常信息
export function getWrongTop(): ApiPromise<ApiResponse> {
	return request({
		url: '/management/modules/monitor/agent/getWrongTop',
		method: 'get',
	});
}

// 更新当天的不参加top展示的断采信息
export function updateCollectTopStatusByIp(query: any): ApiPromise<ApiResponse> {
	return request({
		url: '/management/modules/monitor/agent/updateCollectTopStatusByIp',
		method: 'get',
		params: query,
	});
}

// 根据ip过滤掉当前的异常top排名
export function updateWrongTopStatusByIp(query: any): ApiPromise<ApiResponse> {
	return request({
		url: '/management/modules/monitor/agent/updateWrongTopStatusByIp',
		method: 'get',
		params: query,
	});
}

// 修改阀值
export function updateThresholdByCode(data: any): ApiPromise<ApiResponse> {
	return request({
		url: '/management/modules/monitor/agent/threshold/updateThresholdByCode',
		method: 'post',
		data: data,
	});
}

//查询agent阀值
export function queryAgentThresholdByCode(): ApiPromise<ApiResponse> {
	return request({
		url: '/management/modules/monitor/agent/threshold/queryAgentThresholdByCode',
		method: 'get',
	});
}

// 根据查询条件搜索agentip信息
export function getAgentIpList(query: any): ApiPromise<ApiResponse> {
	console.log('getAgentIpList', query);
	return request({
		url: '/management/modules/monitor/agentIp/getAgentIpList',
		method: 'get',
		params: query,
	});
}

// 更新agentip信息
export function updateAgentByIp(data: any): ApiPromise<ApiResponse> {
	return request({
		url: '/management/modules/monitor/agentIp/updateAgentByIp',
		method: 'post',
		data: data,
	});
}

// 批量删除agentIp
export function deleteAgentByIps(ips: any): ApiPromise<ApiResponse> {
	return request({
		url: '/management/modules/monitor/agentIp/deleteAgentByIps/' + ips,
		method: 'delete',
	});
}

// 获取agent列表，按ip和状态查询
export function getAgentShowList(data: any): ApiPromise<ApiResponse> {
	return request({
		url: '/management/modules/monitor/agent/getAgentShowList',
		method: 'post',
		data: data,
	});
}

// 丢包率历史曲线图(agentIp,startTime,endTime)
export function lostHistoryLine(data: any): ApiPromise<ApiResponse> {
	return request({
		url: '/management/modules/monitor/agent/lostHistoryLine',
		method: 'post',
		data: data,
	});
}

// 流量历史曲线图(agentIp,startTime,endTime)
export function speedHistoryLine(data: any): ApiPromise<ApiResponse> {
	return request({
		url: '/management/modules/monitor/agent/speedHistoryLine',
		method: 'post',
		data: data,
	});
}

// 查询agent详细
export function getAgentDetail(data: any): ApiPromise<ApiResponse> {
	return request({
		url: '/management/modules/monitor/agent/getAgentDetail',
		method: 'post',
		data: data,
	});
}

// 查询agent启动历史时间列表
export function getHistoryRebootTime(query: any): ApiPromise<ApiResponse> {
	return request({
		url: '/management/modules/monitor/agent/getHistoryRebootTime',
		method: 'get',
		params: query,
	});
}
